<!-- <mobile_picwall array-data-key="bus_info.config.home_imgs"></mobile_picwall> -->
{{#> "mobile_picwall"}}
{{#if $Cache.main.drawlist.length}}
<a class="draw-icon" href="#default/draw">
	<img src="/images/draw.jpg" />
</a>
{{/if}}

<!-- goods -->
<div class="_main_goods">
	{{#each goods_list}}
	{{#> "mobilemaingoods"}}
	{{/each}}


	{{#each $Cache.main.classify_with_goods}}
		{{#if contents.length>0}}
		<div class="main_tag_title">{{title}}</div>
		{{#each contents}}
			{{#> "mobilemaingoods","$This",6 > $Index}}
		{{/each}}
		{{/if}}
	{{/each}}
</div>

<div class="bottom">
	<a href="#default/goods_list?id=3">点此查看更多商品</a>
</div>

<!-- <xmp type="tag" name="mobile_picwall">
	<div class="picwall">
		<div class="carosule">
			<div class="pic-show">
			{{#if ${array-data-key}.length }}
				{{#each ${array-data-key} }}
				<div style="z-index:{{$Parent.length-$Index}}" class="pic">
					<a target="_blank" bind-href="{{href||'javascript:void 0'}}">
						<img bind-src="{{img_url}}?imageView/1/w/500/h/200" />
					</a>
				</div>
				{{/each}}
			{{#else}}
				<div style="z-index:{{$Parent.length-$Index}}" class="pic">
					<a target="_blank" bind-href="{{href||'javascript:void 0'}}">
						<img bind-src="/images/default_bg.jpg" />
					</a>
				</div>
			{{/if}}
			</div>
		</div>
	</div>
	<script type="text/vm">
		function(vm) {
			var picwall = vm.queryElement({
				className: 'picwall'
			})[0];
			var img = vm.queryElement({
				tagName: "IMG"
			});
			require(["jQuery"], function($) {
				var w = $(picwall).width();
				$(picwall).height(w * 0.4);
				var current_pic;
				var pics = $(".pic");
				var len=$(pics).length;
				if (len>1) {
					var i=1;
					var timer = setInterval(function() {
						$(pics[i%len]).fadeIn(1000);
						$(pics[(i-1)%len]).fadeOut(1000);
						i+=1;
					}, 5000);
				};
				
			});
		}
	</script>
</xmp> -->
<xmp type="template" name="mobile_picwall">
	<div class="mobile_picwall">
		<div class="movebox">
			{{#each bus_info.config.home_imgs}}
			<img data="{{$Index}}" bind-src="{{img_url}}?imageView2/1/w/500/h/200" />
			{{/each}}
		</div>
	</div>
	<script type="text/vm">
 	function(vm) {
 		var box = vm.queryElement({
 			className : 'mobile_picwall'
 		})[0];
 	    var movebox = vm.queryElement({
 	        className: 'movebox'
 	    })[0];
 	    require(['jQuery', 'touch'], function($, touch) {
 	        var $movebox = $(movebox);
 	        var $img = $("img");
 	        var len = $movebox.find('img').length;
 	        var w = $(box).width();
 	        $movebox.height(w * 0.4);
 	        var _count = 0;
 	        var _ti = setInterval(function() {
 	            var css = "translateX(-" + _count % len * 100 + "%)";
 	            $movebox.css({
 	                "transform": css,
 	                "-webkit-transform": css
 	            });
 	            _count += 1;
 	        }, 5000);
 	        touch.on($img, "swipeleft", function() {
 	            var _init = parseInt($(this).attr("data")) + 1;
 	            if (_init < len) {
 	                clearInterval(_ti);
 	                _count = _init;
 	                var css = "translateX(-" + _count % len * 100 + "%)";
 	                $movebox.css({
 	                    "transform": css,
 	                    "-webkit-transform": css
 	                });
 	                _ti = setInterval(function() {
 	                    var css = "translateX(-" + _count % len * 100 + "%)";
 	                    $movebox.css({
 	                        "transform": css,
 	                        "-webkit-transform": css
 	                    });
 	                    _count += 1;
 	                }, 5000);
 	            }
 	        });
 	        touch.on($img, "swiperight", function() {
 	            var _init = parseInt($(this).attr("data"));
 	            if (_init > 0) {
 	                clearInterval(_ti);
 	                _count = _init - 1;
 	                var css = "translateX(-" + _count % len * 100 + "%)";
 	                $movebox.css({
 	                    "transform": css,
 	                    "-webkit-transform": css
 	                });
 	                _ti = setInterval(function() {
 	                    var css = "translateX(-" + _count % len * 100 + "%)";
 	                    $movebox.css({
 	                        "transform": css,
 	                        "-webkit-transform": css
 	                    });
 	                    _count += 1;
 	                }, 5000);
 	            }
 	        });
 	    });
 	}
	</script>
</xmp>
<xmp type="template" name="mobilemaingoods">
	<div class="mobilemaingoods">
		<a href="#default/goods_details?id={{_id}}">
			<img bind-src="{{preview_img_url}}?imageView/1/h/150/w/150" />
		</a>
		<div class="goods_info">
			<a href="#default/goods_details?id={{_id}}">
				<div class="item">{{goods_name}}</div>
			</a>
			<div class="item">
				<span class="price">
					￥{{#Fixed card_cash_map[$Top.loginer.current_card_factory_id]||cash}}
				</span>
			</div>
		</div>
	</div>
</xmp>